<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
	<title>系统参数</title>
	<style>
		table >  tr:nth-child(odd)  > td { backgroud-color:#c8c8c8}
	</style>
</head>
<body menuId="10">
<!--Action boxes-->
<div class="container-fluid">
	<hr>
	<div class="row-fluid">
		<div class="span12">
			<div class="widget-box">
				<div class="widget-title">
						<span class="icon"> <i class="fa fa-th"></i>
						</span>
					<h5></h5>
					<!--<span class="label label-info">
						<u:authority menuId="1">
							<a href="javascript:;" onclick="add()">添加系统参数</a>
						</u:authority>
						</span>-->
					<div class="search">
						<form method="post" id="mainForm" action="${ctx}/paramConf/query">
						</form>
					</div>
				</div>
				<div class="widget-content nopadding">
					<table class="table table-bordered table-striped table-striped-20171201">
						<thead>
						<tr>
							<th>序号</th>
							<th>参数键</th>
							<th>状态</th>
							<th>参数值</th>
							<th>描述</th>
							<th>参数类型</th>
							<th>更新时间</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						<s:iterator value="jpage.data" status="L">
							<tr>
								<td>${(jpage.page-1)*jpage.rows+L.index+1}</td>
								<td><u:ucparams key="${paramKey}" type="param_key"/></td>
								<s:if test="paramStatus == 1">
									<td>有效</td>
								</s:if>
								<s:else>
									<td>无效</td>
								</s:else>
								<td>${paramValue}</td>
								<td>${description}</td>
								<s:if test="paramType == 0">
									<td>系统参数</td>
								</s:if>
								<s:else>
									<td>SMSP参数</td>
								</s:else>
								<td><s:date name="updateDate"
											format="yyyy-MM-dd HH:mm:ss"/></td>
								<td>
									<u:authority menuId="90"><a href="javascript:;" onclick="edit('${paramId}')">编辑</a></u:authority>
									<s:if test="paramStatus == 1">
										<u:authority menuId="4018"><a href="javascript:;" onclick="disable('${paramId}','<u:ucparams key="${paramKey}" type="param_key"/>')">置为无效</a></u:authority>
									</s:if>
									<s:else>
										<u:authority menuId="4018"><a href="javascript:;" onclick="enable('${paramId}','<u:ucparams key="${paramKey}" type="param_key"/>')">置为有效</a></u:authority>
									</s:else>
								</td>
							</tr>
						</s:iterator>
						</tbody>
					</table>
				</div>
				<u:jpage jpage="${jpage}" formId="mainForm" />
			</div>
		</div>
	</div>
</div>
</div>

<script type="text/javascript">
    //添加
    function add() {
        location.href = "${ctx}/paramConf/edit";
    }

    //编辑
    function edit(id) {
        location.href = "${ctx}/paramConf/edit?param_id=" + id;
    }



    //置为失效
    function disable(id,name) {
        var r=confirm("确定将参数【"+name+"】置为无效？")
        if (r==true)
        {
            $.ajax({
                url : '${ctx}/paramConf/disable?paramId='+id,
                dataType : 'json',
                success : function(result){
                    alert(result.msg);
                    window.location.reload()
                }
            })
        }

    }
    //置为有效
    function enable(id,name) {
        var r=confirm("确定将参数【"+name+"】置为有效？")
        if(r==true){
            $.ajax({
                url : '${ctx}/paramConf/enable?paramId='+id,
                dataType : 'json',
                success : function(result){
                    alert(result.msg);
                    window.location.reload()
                }
            })
        }
    }
</script>
</body>
</html>